import axios,{InternalAxiosRequestConfig,AxiosResponse,AxiosError} from 'axios'
axios.defaults.baseURL="http://www.zhaijizhe.cn:3005"
axios.defaults.timeout=5000
axios.interceptors.request.use((config:InternalAxiosRequestConfig)=>{
    const token=localStorage.getItem('token')
    if(token){
        config.headers.Authorization=token
    }
    return config
})
axios.interceptors.response.use((response:AxiosResponse)=>{
    return response
},(error:AxiosError)=>{
    return Promise.reject(error)
})
export default axios